import { buildingList, buildingPage, buildingAdd, buildingUpdate, buildingDelete } from '@/api/base.building'
export default {
  namespaced: true,
  state: {},
  actions: {
    getBuildingList() {
      return new Promise((resolve, reject) => {
        buildingList().then(
          res => {
            resolve(res)
          }
        )
      })
    },
    //context 对象是vuex框架自己放入到第一个参数,界面上调用时传入的参数,需要放入第二个参数
    getBuildingPage(context, data) {
      return new Promise((resolve, reject) => {
        buildingPage(data).then(
          res => {
            resolve(res)
          }
        )
      })
    },
    addBuilding(context, data) {
      return new Promise((resolve, reject) => {
        console.log(data)
        buildingAdd(data).then(
          resolve()
        )
      })
    },
    updateBuilding(context,data) {
      return new Promise((resolve, reject) => {
        buildingUpdate(data).then(
          console.log(data),
          resolve()
        )
      })
    },
    deleteBuilding(context,id) {
        return new Promise((resolve, reject) => {
          buildingDelete(id).then(
            resolve()
          )
        })
      }
  }
}